package com.emmy.walnut.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;

import com.emmy.walnut.model.Label;

import java.util.List;

/**
 * @ClassName LabelDao
 * @Description TODO
 * @Author zhouxuan
 * @Date 2020/02/04 12:13
 * @Version 1.0
 */
@Dao
public interface LabelDao {

    @Query("select * from label")
    List<Label> getAll();

    @Query("select * from label where not isCustomize or username = :username")
    List<Label> getLabelWithUser(String username);

    @Query("select * from label where (not isCustomize or username = :username) and labelName = :labelName")
    List<Label> getLabelWithUserAndLabel(String username, String labelName);

    @Insert
    long[] insertAll(Label... label);

    @Insert
    long insert(Label label);

    @Delete
    void delete(Label label);
}
